"""
运算符
"""

# ----------算数运算符-----------
# num1 = 10
# num2 = 20
#
# print(f"num1:{num1},num2:{num2},num1+num2={num1+num2}")
# print(f"num1:{num1},num2:{num2},num1-num2={num1-num2}")
# print(f"num1:{num1},num2:{num2},num1*num2={num1*num2}")
# print(f"num1:{num1},num2:{num2},num1/num2={num1/num2}")

# ----------赋值运算符-----------
print("----------赋值运算符-----------")
num1 = 10
num2 = 10
num3 = 10
num4 = 10
num5 = 10
num6 = 10
print(f"num1 is : {num1}")
# += 加法赋值
num1 += 10
print(f"num1 += 10, the result of num1 is : {num1}")

num2 -= 5
print(f"num2 is : {num2}")

num3 *= 10
print(f"num3 is : {num3}")

num4 /= 5
print(f"num4 is : {num4}")

num5 %= 3
print(f"num5 is : {num5}")

num6 **= 10
print(f"num6 is : {num6}")

# := 海象运算符 ==》会将计算的结果返回
print(f"num := num1 + num2, the result of num is : ",{num := num1 + num2})


# 成员运算符
print("------------------成员运算符-----------------")
num1 = 10
num2 = 200
numbers = [10,20,30,40,50]
print(num1 in numbers)
print(num2 in numbers)

# 身份运算符 ：判断是否在同一个地址
print("--------------------身份运算符-----------------------")
m = 20
n = 20
q = 30
# 有一个常量池，所以 m,n 指向同一个地址
print( m is n)
print(n is q)

# == 和 is 的区别 ： == 会根据对象 equals 方法判断值是否相同，is 是判断地址
print("-----------------== 和 is的区别--------------------")
num1 = [10,20,30,40]
num2 = num1
num3 = num1[:]  # 对 num1 切片，在地址中重新开辟空间，将数据填入，地址不同，成员对象值相同
print(num1 == num2)
print(num1 == num3)
print(num1 is num2)
print(num1 is num3)